//左侧菜单栏
layui.use(['element' , 'form' , 'laydate'], function() {
    var element = layui.element;
    var form = layui.form;
    var laydate = layui.laydate;
    laydate.render({
        elem: '.test-item',
        trigger: 'click',
    });
    laydate.render({
        elem: '.test-item1',
        trigger: 'click',
    });
});
//选中样式
$('.label-nav-con li').click(function() {
    $(this).addClass('current').siblings().removeClass('current');
})

//保存健康档案信息
function saveBasicHealthyInfo(jumpUrl) {
    //获取数据信息
    var basicHealthyForm =new FormData(document.getElementById("basicHealthyForm"));
    layui.use('layer', function(){
        var layer = layui.layer;
        var loading;
        //获取住院编号
        var inNo =$("#inNo").val();
        if(inNo==''){
            layer.msg("请输入住院编号");
            return false;
        }
        $.ajax({
            url:getRootPath_web()
                +'wardRound/saveBaseHealthyInfo',
            type:'post',
            dataType:'json',
            data:basicHealthyForm,
            processData: false,
            contentType: false,
            beforeSend:function () {
                loading = layer.load(1, {
                    shade: [0.9,'#fff']
                    ,shadeClose:false
                });
            },
            success:function (result) {
                if(result.code=='0000'){
                    window.location.href=getRootPath_web()
                        +jumpUrl+"?userNo="+$("#userNo").val()+"&batchNo="+result.batchNo;
                }else {
                    layer.confirm(result.codeDesc, {
                        btn: ['确定'] //按钮
                        ,shadeClose: false
                        ,closeBtn:false
                    }, function(){
                        layer.close(layer.index);
                        layer.close(loading);
                    })
                }
            }
        })
    });
}

//返回
function returnToList(url) {
    window.location.href = getRootPath_web()
        + url;
}

//查询护理详情
function nursingInfo(obj) {
    var imgUlr = obj.id;
    var str="<div id=\"pop-con\">";
    str+="<div class=\"pop-up\">";
    str+="<div>";
    str+="<div class=\"pop-title relative overflow mb15px\">";
    str+="<span class=\"ml15px\">护理内容</span>";
    str+="<p class=\"right cursor\"><img src='"+getRootPath_web()+"static/img/close_icon.png' class=\"block pop-close\"></p>";
    str+="</div>";
    str+="<div class=\"mt10px\">";
    str+="<p><img src='"+imgUlr+"' alt=\"\"></p>";
    str+="</div>";
    str+="</div>";
    str+="</div>";
    str+="</div>";
    layui.use(['layer'], function() {
        var layer = layui.layer;
        layer.open({
            type: 1,
            title: false, //不显示标题栏
            closeBtn: false,
            offset:'auto',
            area: ["$('div#pop-con') + width() + 'px'", ''],
            shade: 0.6,
            id: 'payCons', //设定一个id，防止重复弹出
            /*,btn: ['确认支付']*/
            btnAlign: 'c',
            moveType: 1, //拖拽模式，0或者1
            shadeClose: true, //设置允许点遮罩关闭
            content: str,
            success: function() {
                //关闭弹层
                $(".pop-close").click(function() {
                    layer.closeAll();
                });
            },
        });
    });
}